<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QCloseEvent Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QCloseEvent Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QCloseEvent class contains parameters that describe a close event. <a href="#details">More...</a></p>
<p>Inherits <a href="qevent.html">QEvent</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qcloseevent.html#QCloseEvent">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qcloseevent.html#QCloseEvent-2">__init__</a></b> (<i>self</i>, QCloseEvent)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QCloseEvent class contains parameters that describe a close event.</p>
<p>Close events are sent to widgets that the user wants to close, usually by choosing "Close" from the window menu, or by clicking the <b>X</b> title bar button. They are also sent when you call <a href="qwidget.html#close">QWidget.close</a>() to close a widget programmatically.</p>
<p>Close events contain a flag that indicates whether the receiver wants the widget to be closed or not. When a widget accepts the close event, it is hidden (and destroyed if it was created with the <a href="qt.html#WidgetAttribute-enum">Qt.WA_DeleteOnClose</a> flag). If it refuses to accept the close event nothing happens. (Under X11 it is possible that the window manager will forcibly close the window; but at the time of writing we are not aware of any window manager that does this.)</p>
<p>The event handler <a href="qwidget.html#closeEvent">QWidget.closeEvent</a>() receives close events. The default implementation of this event handler accepts the close event. If you do not want your widget to be hidden, or want some special handing, you should reimplement the event handler and <a href="qevent.html#ignore">ignore</a>() the event.</p>
<p>The <a href="mainwindows-application.html#close-event-handler">closeEvent() in the Application example</a> shows a close event handler that asks whether to save a document before closing.</p>
<p>If you want the widget to be deleted when it is closed, create it with the <a href="qt.html#WidgetAttribute-enum">Qt.WA_DeleteOnClose</a> flag. This is very useful for independent top-level windows in a multi-window application.</p>
<p><a href="qobject.html">QObject</a>s emits the <a href="qobject.html#destroyed">destroyed()</a> signal when they are deleted.</p>
<p>If the last top-level window is closed, the <a href="qapplication.html#lastWindowClosed">QApplication.lastWindowClosed</a>() signal is emitted.</p>
<p>The <a href="qevent.html#accepted-prop">isAccepted</a>() function returns true if the event's receiver has agreed to close the widget; call <a href="qevent.html#accept">accept</a>() to agree to close the widget and call <a href="qevent.html#ignore">ignore</a>() if the receiver of this event does not want the widget to be closed.</p>
<p>See also <a href="qwidget.html#close">QWidget.close</a>(), <a href="qwidget.html#hide">QWidget.hide</a>(), <a href="qobject.html#destroyed">QObject.destroyed</a>(), <a href="qcoreapplication.html#exec">QCoreApplication.exec</a>(), <a href="qcoreapplication.html#quit">QCoreApplication.quit</a>(), and <a href="qapplication.html#lastWindowClosed">QApplication.lastWindowClosed</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QCloseEvent" />QCloseEvent.__init__ (<i>self</i>)</h3><p>Constructs a close event object.</p>
<p>See also <a href="qevent.html#accept">accept</a>().</p>
<p /><h3 class="fn"><a name="QCloseEvent-2" />QCloseEvent.__init__ (<i>self</i>, <a href="qcloseevent.html">QCloseEvent</a>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.7.1-5014f7c72a58 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.1</td></tr></table></div></address></body></html>